<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:r="http://richfaces.org/rich">


	<div class="headerDiv">
		<h:outputLink value="#{request.contextPath}/resultAll.jsf">Übersicht alle Aktien</h:outputLink>
	</div>
	<div class="headerDiv">
		<h:inputTextarea immediate="true" style="width: 140px; height:60px;"
			value="#{importController.wkns}">
			<a4j:ajax event="blur" />
		</h:inputTextarea>


	</div>
	<div class="headerDiv">
		<a4j:commandButton id="startImport"
			disabled="#{not empty importController.importStockWorker and importController.importStockWorker.running}"
			render="startImport" oncomplete="reRenderImportStatus();"
			style="width:80%;" actionListener="#{importController.importStocks}"
			value="Import Stocks" />
	</div>
	<a4j:outputPanel id="importStatus" style="font-size:6pt;">
		<div class="headerDiv">

			<h:outputText
				rendered="#{empty importController.importStockWorker or not importController.importStockWorker.running}"
				value="Importer not running" />
			<br />
			<a4j:outputPanel
				rendered="#{not empty importController.importStockWorker}">
				<h:outputText
					value="#{importController.importStockWorker.importedTickerListSize} were imported successfully" />
				<br />
				<h:outputText
					value="#{importController.importStockWorker.notImportedTickerListSize} could not be imported" />
				<br />
			</a4j:outputPanel>

		</div>
		<div class="headerDiv">
			<h:outputText
				rendered="#{not empty importController.importStockWorker and importController.importStockWorker.running}"
				value="Importer running!!!" />
			<r:progressBar 
				rendered="#{not empty importController.importStockWorker and importController.importStockWorker.running}"
				interval="10000" onbeforedomupdate="reRenderImportStatus();"
				onfinish="reRenderImportStatus();"
				label="#{importController.importStockWorker.importedWknListSize}/#{importController.importStockWorker.tickerListSize}"
				mode="ajax" enabled="#{importController.importStockWorker.running}"
				minValue="0"
				maxValue="#{importController.importStockWorker.tickerListSize}"
				value="#{importController.importStockWorker.importedTickerListSize}">
			</r:progressBar>
		</div>
	</a4j:outputPanel>
	<a4j:jsFunction name="reRenderImportStatus" render="importStatus,startImport" />

</ui:composition>
